package com.example.yyg.springframework.beans.factory.support;

import com.example.yyg.springframework.beans.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {

    Map<String, Object> beanMap = new HashMap<>();

    @Override
    public Object getSingleton(String beanName) {
        return beanMap.get(beanName);
    }

    public void addSingleton(String beanName, Object bean) {
        beanMap.put(beanName, bean);
    }

}
